#include <iostream>
#include <vector>

using namespace std;

const int N = 1e5 + 10;

int n, m;
vector<int> edges[N], ret;

void dfs(int x)
{
	while(edges[x].size())
	{
		int y = edges[x].back();
		edges[x].pop_back();
		dfs(y);
	}
	ret.push_back(x);
}

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++)
	{
		int a, b; cin >> a >> b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	
	dfs(1);
	
	for(int i = m + m; i >= 0; i--)
		cout << ret[i] << endl;
	
	return 0;
}














